package bje;

import static org.junit.Assert.assertEquals;
import org.junit.Test;

/**
 * JUnit tests for the amount of bullet power calculated by the robot Surfer method calcNumBullets.
 * 
 * @author Jeffrey Beck
 */
public class TestCalcNumBullets {

  private static String BULLETS_3 = "Number of bullets equals 3";
  private static String BULLETS_2 = "Number of bullets equals 2";
  private static String BULLETS_1 = "Number of bullets equals 1";
  
  /**
   * Tests the number of bullets to be fired based on the distance argument to the method
   * calcNumBullets. The number of bullets should be 3 if distance is between 0 and 200 pixels, 2 if
   * distance is between 201 and 300 pixels, or 1 if neither condition applies. Uses equivalence
   * class partitioning.
   */
  @Test
  public void testCalcNumBullets() {
    Surfer surfer = new Surfer();
    assertEquals(BULLETS_3, 3, surfer.calcNumBullets(199));
    assertEquals(BULLETS_3, 3, surfer.calcNumBullets(200));
    assertEquals(BULLETS_2, 2, surfer.calcNumBullets(201));
    assertEquals(BULLETS_2, 2, surfer.calcNumBullets(299));
    assertEquals(BULLETS_2, 2, surfer.calcNumBullets(300));
    assertEquals(BULLETS_1, 1, surfer.calcNumBullets(301));
    assertEquals(BULLETS_1, 1, surfer.calcNumBullets(1000));
    assertEquals(BULLETS_3, 3, surfer.calcNumBullets(0));
    assertEquals(BULLETS_3, 3, surfer.calcNumBullets(1));
    assertEquals(BULLETS_1, 1, surfer.calcNumBullets(-1));
  }

}